package io.gitee.wiqer.simple;

import java.util.HashMap;

public class SolutionNC68_JumpFloor {
     HashMap<Integer,Integer> map;
     {
        map =new HashMap<>();
        map.put(1,1);
        map.put(2,2);
        map.put(3,3);
        map.put(4,5);
        map.put(5,8);
    }

    //第一步是跳1步是jumpFloor(target-1)
    //第一步是跳2步jumpFloor(target-2)
    //总步数是jumpFloor(target-1)+ jumpFloor(target-2)
    public  int jumpFloor(int target) {
        if(target<1)return 0;
        Integer max =map.get(target);
        if(max!=null)return max;
        max = jumpFloor(target-1)+ jumpFloor(target-2);;
        map.put(target,max);
        return max;
    }
}
